<template>
  <div>
    <!-- 头部导航 -->
      <div class="hearder">
        <div class="button" @click="$router.go(-1)">
        <span class="iconfont icon-fanhui"></span>
      </div>
        <div class="center">推荐新音乐</div>
        <router-link tag="div" to="/search" class="right iconfont icon-sousuo"></router-link>
      </div>
        <!-- 导航按钮 -->
      <div class="navs">
        <router-link tag="div" to="/recommend" class="item">
          <span>推荐</span>
        </router-link>
        <router-link tag="div" to="/rank" class="item">
          <span>排行榜</span>
        </router-link>
        <router-link tag="div" to="/singer" class="item">
          <span>歌手</span>
        </router-link>
      </div>
    <!-- 推荐内容 -->
    <div class="content">
        <!-- <h2>推荐新音乐</h2> -->
      <ul>
        <li v-for="(item, index) in title" :key="index" >
          <div class="img" @click="setId(item.id)">
            <img :src="item.picUrl" alt="" />
          </div>
          <p>{{ item.name }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// import headerNav from "../components/base/headerNav.vue";
import { getpersonalizedcon } from "../api/personalized";
export default {
  data: function () {
    return {
      title: null,
    };
  },
  components: {
    // headerNav,
  },

  created() {
    //获取新音乐数据
    getpersonalizedcon().then((data) => {
     
       this.title = data.result;
    });
  },

   methods: {
     setId(id) {
      // 播放全部歌曲
      this.$emit("get-player-id", id);
    },
  },
};
</script>

<style lang="less">
.hearder{
  background-color: #D44439;
  color: #fff;
  height: 39px;
  line-height: 39px;
  display: flex;
  text-align: center;
   .button{
       width: 45px;
       height: 45px;
       line-height: 45px;
       text-align: center;
       font-size: 16px;
       color: white;
       span{
         font-weight: bolder;
         font-size: 20px;
       }
    }
  .center{
    flex:1
  }
}   
 .searchcon {
    display: flex;
    width: 100%;
    height: 45px;
    background-color: #D44439;
    // position: fixed;
    // top: 0;
    // z-index: 99;
    .button{
       width: 45px;
       height: 45px;
       line-height: 45px;
       text-align: center;
       font-size: 16px;
       color: white;
       span{
         font-weight: bolder;
         font-size: 20px;
       }
    }
     h3{  position: absolute;
         right: calc(50% - 48px);
         color: white;
         line-height: 45px;
         font-size: 20px;
       }    
}
.content {
    padding-top: 10px;
    text-align: center;
    h2{ margin-top: 5px;
        margin: 0 auto ;
    }
  ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    
    li {
      flex: 0 0 32%;
      position: relative;
      span {
        position: absolute;
        top: 0;
        right: 0;
        color: #fff;
        font-size: 10px;
      }
      i {
        font-size: 15px;
        vertical-align: middle;
      }
       .img {
      min-height: 50px;
      width: 100%;
      border-radius: 3px;
      img {
        width: 100%;
        border-radius: 3px;
      }
    }
    p {
      font-size: 12px;
      color: #565658;
      line-height: 15px;
      padding: 5px;
      margin-bottom: 10px;
      height: 10px;
      overflow: hidden;
    }
    }
   
  }
}
</style>